package com.nuoniu.sibanyun.service.erp.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;

import com.nuoniu.sibanyun.entity.erp.ErpProjectClass;
import com.nuoniu.sibanyun.mapper.erp.ErpProjectClassMapper;
import com.nuoniu.sibanyun.service.erp.IErpProjectClassService;
import com.nuoniu.sibanyun.userThread.UserInfo;
import com.nuoniu.sibanyun.userThread.UserThreadLocal;
import org.springframework.stereotype.Service;

/**
 * <p>
 * 项目分类 服务实现类
 * </p>
 *
 * @author baiqiang
 * @since 2020-10-12
 */
@Service
public class ErpProjectClassServiceImpl extends ServiceImpl<ErpProjectClassMapper, ErpProjectClass> implements IErpProjectClassService {

    @Override
    public Page<ErpProjectClass> pageList(Page pages, ErpProjectClass projectClass) {
        UserInfo userInfo = UserThreadLocal.get();
        QueryWrapper<ErpProjectClass> queryWrapper = new QueryWrapper<>(projectClass);
        queryWrapper.eq("company_id", userInfo.getCompanyId());
        queryWrapper.orderByDesc("create_date");
        Page page = page(pages, queryWrapper);
        return page;
    }
}
